const resolve = require('path').resolve
module.exports = {
    lintOnSave: false,
    devServer: {
        // port: port,
        // open: true,
        overlay: {
            warnings: false,
            errors: true
        },
        // 配置跨域
        proxy: {
            "^/api/validate": {
                target: "http://11.51.194.12:8888",//清铢
                ws: true,
                changOrigin: true, // 允许跨域
                pathRewrite: {
                    "^/api": ""
                }
            },
            "^/api": {
                target: "http://11.51.194.12:8888",//清铢
                ws: true,
                changOrigin: true, // 允许跨域
            },
            "^/open": {
                target: "http://11.51.194.12:8888",//清铢
                ws: true,
                changOrigin: true, // 允许跨域
            },
            "^/oauth": {
                target: "http://11.51.194.12:8888",//清铢
                ws: true,
                changOrigin: true, // 允许跨域
            },
            "^/task": {
                target: "http://11.51.193.249:6070",//任务中心
                ws: true,
                changOrigin: true, // 允许跨域
            },
        }
    },
    chainWebpack: config => {
        config.resolve.alias.set('@', resolve('src'))
        config.plugins.delete('prefetch')
        if (process.env.npm_config_report) {
            config
                .plugin('webpack-bundle-analyzer')
                .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
        }
    },
    configureWebpack: config => {
        if (process.env.NODE_ENV === 'production') {
            config.optimization.minimizer[0].options.terserOptions.compress.drop_console - true
        } else {
            config.devtool = 'cheap-source-map'
        }
        // plugins: [
        //   new webpack.ProvidePlugin({
        //     jQuery: 'jquery',
        //     $: 'jquery'
        //   })
        // ]
    },
    productionSourceMap: false,
}